/*
 * @Author: li2022 liqing@linkon.me
 * @Date: 2023-05-12 10:20:21
 * @LastEditors: dazy dazy916@126.com
 * @LastEditTime: 2025-09-20 18:43:15
 * @FilePath: \lianpeng_cms\src\router\router.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { createRouter, createWebHistory } from "vue-router"
// 1. 定义路由组件， 注意，这里一定要使用 文件的全名（包含文件后缀名）

// 2. 定义路由配置
const routes = [
    {
        path: "/",
        redirect: '/index'
    },
    {
        path: "/index",
        name: "index",
        component: () => import('/src/pages/index.vue'),
    },
    {
        path: "/teachIndex",
        name: "teachIndex",
        component: () => import('/src/pages/teacher/index.vue'),
        children: [
        ]
    },
    {
        path: "/teachOne",
        name: "teachOne",
        component: () => import('/src/pages/teacher/one.vue'),
    },
    {
        path: "/teachTwo",
        name: "teachTwo",
        component: () => import('/src/pages/teacher/two.vue'),
    },
    {
        path: "/teachThree",
        name: "teachThree",
        component: () => import('/src/pages/teacher/three.vue'),
    },
    {
        path: "/teachFour",
        name: "teachFour",
        component: () => import('/src/pages/teacher/four.vue'),
    },
    {
        path: "/studentIndex",
        name: "studentIndex",
        component: () => import('/src/pages/student/index.vue'),
    },
    {
        path: "/studentOne",
        name: "studentOne",
        component: () => import('/src/pages/student/one.vue'),
    },

    {
        path: "/studentTwo",
        name: "studentTwo",
        component: () => import('/src/pages/student/two.vue'),
    },

    {
        path: "/studentThree",
        name: "studentThree",
        component: () => import('/src/pages/student/three.vue'),
    },
    {
        path: "/studentFour",
        name: "studentFour",
        component: () => import('/src/pages/student/four.vue'),
    }, 
    // {
    //     path: "/404",
    //     name: "404",
    //     component: () => import('/src/pages/404.vue'),
    // }

];
// 3. 创建路由实例
const router = createRouter({
    // 4. 采用hash 模式
    // history: createWebHashHistory(),
    // 采用 history 模式
    history: createWebHistory(),
    routes, // short for `routes: routes`
});

// 5.全局前置守卫
router.beforeEach((to, from, next) => {
    // console.log(to, from)
    next()
    // if (to.name === 'login' || to.name === 'padIndex' || to.name === 'instructions' || to.name === 'index') {
    //     next()
    // } else {
    //     if (sessionStorage.getItem('token')) {
    //         if (to.name) {
    //             next()
    //         } else {
    //             router.push('404')
    //         }
    //     } else {
    //         router.push('login')
    //     }
    // }

})
export default router

